/**
 * 2018年11月28日下午10:38:10
 * @author 谢进财
 */
package com.baihang.project.ds.controller;

import java.io.File;
import java.io.IOException;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;

import com.baihang.framework.kit.PathKit;

/**
 * 测试控制器
 *
 */
@Controller
@RequestMapping("/test")
public class TestController {
	
	@RequestMapping("showTest")
	public String showTest() {
		return "/project/ds/test/upload";
	}
	@RequestMapping("/upload")
	public String fileuplad(MultipartFile file) {
		String filepath = PathKit.getWebRootPath()+"/upload/"+file.getOriginalFilename();
		System.err.println(filepath);
		try {
			file.transferTo(new File(filepath));
		} catch (IllegalStateException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return "login";
	}
}
